<template>
    <div class="container yuan-container">
        <a-spin tip="Loading..." :spinning="loading">
            <a-form-model layout="inline" class="yuan-form" ref="form" :model="formData" :rules="rules"
                :label-col="{ style: { width: '150px' } }" :wrapper-col="{ style: { width: 'calc(100% - 160px)' } }">

                <div class="form-panel yuan-form-col3">
                    <div class="form-panel-box">
                        <div class="form-title">邀请新用户获得积分</div>
                        <a-form-model-item class="yuan-form-item" label="获得积分" prop="integralNum" style="padding:20px 0">
                            <a-input class="yuan-form-input" placeholder="请输入积分数量" v-model="formData.integralNum"></a-input>
                        </a-form-model-item>

                    </div>

                </div>
                <!-- <div class="form-panel yuan-form-col3">
                    <div class="form-panel-box">
                        <div class="form-title">项目总投资金额(万)</div>
                        <a-form-model-item class="yuan-form-item" label="项目总投资金额(万)" prop="sumMoney" style="padding:20px 0">
                            <a-input class="yuan-form-input" placeholder="请输入项目总投资金额" v-model="formData.sumMoney"></a-input>
                        </a-form-model-item>

                    </div>

                </div> -->
                <div style="margin-top:30px;margin-left:300px">
                    <a-button @click="clickSave" type="primary">
                        确认保存
                    </a-button>
                </div>
            </a-form-model>
        </a-spin>

    </div>
</template>
<script lang="ts">
import api from "@/api/api";
import platformApi from "@/api/platformApi";
import { Component, Vue } from "vue-property-decorator";
@Component({
    name: "tpl",
    components: {},
})
export default class extends Vue {
    loading = false;
    formData = {};
    rules = {
        integralNum: [{ required: true, message: "请填写获得积分数量", trigger: "change" }],
        sumMoney: [{ required: true, message: "请填写项目总投资金额", trigger: "change" }],
    };

    mounted() {
        this.getData();
    }
    async getData() {
        this.loading = true;
        try {
            const res = await platformApi.findInviteIncomeIntegral();
            this.formData = res.data;
        } finally {
            this.loading = false;
        }
    }
    async clickSave() {
        this.loading = true;
        try {
            const res = await platformApi.updateInviteIncomeIntegral(this.formData);
            this.$message.success("保存成功");
        } finally {
            this.loading = false;
        }
    }
}
</script>
<style scoped lang="scss">
.container {
}
</style>
